<template>
  <div>
    <van-sidebar v-model="active">
      <van-sidebar-item v-for="(data,index) in message" :key="index" @click="changeindex(index)" :title="data" />
    </van-sidebar>
  </div>
</template>

<script>
export default {
  data() {
   
    return {
      active:0,
      message: [
        "热品推荐",
        "手机数码",
        "家用电器",
        "电脑办公",
        "个人清洁",
        "汽车生活",
        "男装",
        "女装",
    
      ],
    };
  },

  computed: {
    Cactive() {
      return this.$store.state.SlideOptionIndex;
    },
  },
  watch:{
    Cactive(){
      this.active = this.Cactive;
      this.$store.commit('changeNowIndex',this.active)
    } 
   },
  methods:{
    changeindex(value){
      this.$store.commit('clickslideindex',value)
      this.$store.commit('changeNowIndex',value)
       
    }
  }
};
</script>

<style lang="scss" scoped></style>
